import { CountAdd, CountDes } from '../../action/actionTypes';

const initState = {
  count: 0,
};

export default function countReducer(state = initState, { type, payload }) {
  switch (type) {
    case CountAdd:
      return { ...state, count: state.count + payload };
    case CountDes:
      return { ...state, count: state.count - payload };
    default:
      return state;
  }
}
